package cn.itcast.itcaststore.dao;

import cn.itcast.itcaststore.domain.OrderItem;
import cn.itcast.itcaststore.domain.Orders;
import cn.itcast.itcaststore.domain.User;

import javax.persistence.criteria.Order;
import java.sql.SQLException;
import java.util.List;

/**
 * 订单类
 */
public interface OrderDao {
    /**
     * 添加订单项
     *
     */
    void addOrderItem(Orders order) throws SQLException;
    /**
     * 查找所有订单
     * @return
     */
    List<Orders> findAllOrder() throws SQLException;

    /**
     * 根据订单id和收件人搜索订单
     * @param orderId
     * @param receiverName
     * @return
     * @throws SQLException
     */
    List<Orders> findOrderByManyCondition(String orderId, String receiverName) throws SQLException;

    Orders findOrderById(String orderId) throws SQLException;

    List<OrderItem> findOrderItemByOrder(Orders order) throws SQLException;

    /**
     * 删除订单项
     * @param orderId
     */
    void delOrderItems(String orderId) throws SQLException;

    /**
     * 删除订单
     * @param orderId
     */
    void delOrderById(String orderId) throws SQLException;
    /*
     * 添加订单操作
     * */
    void addOrder(Orders order) throws SQLException;
    /*
    * 查询用户下的所属订单
    *
    * */
    List<Orders> findOrderByUser(final User user) throws SQLException;
    /*
    * 根据订单号修改订单状态
    * @param id
    * @throws SQLException
    * */
    void updateOrderState(String id) throws SQLException;
}
